Skip to content

Client: approve-in-app sign-in, notifications, @mentions - #21

Merged
Spider333 merged 12 commits into
mainfrom
feat/phase1-signin-notifs-mentions
Nov 3, 2026
Merged

Spider333 merged 12 commits into
mainfrom
feat/phase1-signin-notifs-mentions

Conversation

@Spider333

@Spider333 Spider333 commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Phase 1 from PRD-phase1-signin-notifs-mentions.md: an account made in the Farcaster app can sign in by approving Outpost on the phone (no phrase), a notifications view read from your own node, and real @mentions. Draft: David does the live mainnet check of app sign-in (below) before merging. Merging main redeploys the hosted client.

What changed, per PRD story

# Story Where State
1 Sign in by QR approval 5th connect choice "Approve in the Farcaster app" (src/web/app.ts, index.html); src/core/appsignin.ts done
2 App account set up once ./outpost app-account (local, mode 600) and ./outpost app-account --society (key on the society server only, service src/server/appsignin.ts behind Caddy at /app-signin, members only) done; society path tested on the fake server only
3 Told what the key can do first warning before the QR (full access, no expiry, Outpost cannot revoke, where to remove it); key panel labels the key and the button becomes "Forget this key in this browser" done
4 Notifications src/core/notifications.ts, Hub castsByMention, linksByTarget, recastsByCast; web section; ./outpost cli notifications done
5 Unread count header pill with aria-live, "Mark all read" per FID in localStorage, --mark-read in the CLI store; refresh on open, button, poll every 2 min while visible done
6 Mention someone src/core/mentions.ts (extractMentions, UTF-8 byte offsets, max 10, edited picks drop); composer suggestions (followed first, full username looked up on the node and checked against the signed profile); cli cast "hi @dwr" refuses unknown names done
7 Mentions render as names already worked (withMentions in feed.ts); now also in notifications and threads done
8 Click a notification, land on the cast "Open" shows the cast with its replies, focused on the reply; "Thread" on every cast done
9 "via" the app account existing app labels; checked on the devnet ("via @app-...") done
10 cli login --app terminal QR + link, waits, saves done
11, 12 P2: filters, byte counter not done

Other changes: fidByUsername accepts .eth names; on a devnet the page defaults key checks to the devnet's own second node (Optimism mainnet knows nothing of devnet keys); scripts/e2e-phase1.ts and scripts/devnet-lib.ts (devnet end-to-end), test/phase1-demo.ts (click-through demo on a fake node), test/fake-farcaster.ts (stand-in endpoint that checks the app account's EIP-712 signature). gate.ts is unchanged: it runs with no dependencies, and EIP-712 signing needs viem, so the society signer is its own small service, like the sponsor.

No server (--public, added 30 Oct): ./outpost client --public, cli --public and app-account --public (also uninstall) use Farcaster's public node snap.farcaster.xyz:3381 with no SSH tunnel, provider or server; --node <url> or OUTPOST_NODE_URL uses any other node (https, or http on 127.0.0.1; http://example.com is refused). The page says "Using Farcaster's public node, not your own" with a "What does that change?" toggle. Every message check stays. Gasless keys are checked against crackle.farcaster.xyz:3381, a second public node on a separate machine; Farcaster runs both, and the page and TRUST.md say so. serve.js also forwards the second node (GET only) and Optimism (read calls only), so the browser talks only to 127.0.0.1; pictures default to off in this mode for the same reason. Blind verification (6 checks): run 1 failed check 3 on picture loads, fixed; run 2 PASS 6/6. Writing through the public node is untested (no mainnet writes here).

New dependency: uqr 0.1.3 (MIT, no dependencies, QR encoder from unjs, based on Project Nayuki's), bundled into dist/web/app.js and dist/cli.js. No CDN. npm audit is unchanged (the same 4 entries SECURITY.md explains).

Open questions, answered

  • Q1, deep link alone? No. The farcaster://signed-key-request?token=... link carries a token that only Farcaster's endpoint hands out: POST https://api.farcaster.xyz/v2/signed-key-requests {key, requestFid, signature, deadline}, then poll GET /v2/signed-key-request?token= (pending, approved, completed + userFid). No API key. Source: farcasterxyz/docs docs/reference/farcaster/signer-requests.md (last change 5239bd2, 2025-11-20). The call is made by the Outpost server, the society's sign-in service or the CLI, never by the page; TRUST.md names it as the one extra host.
  • Q2, who pays? The approving user, in the Farcaster app, unless the request carries a sponsorship (EIP-191 signature of the request signature by the sponsor FID's custody, and Farcaster requires that app to have warps >= 100). Same doc, "Sponsoring a signer". Default: no sponsorship; ./outpost app-account --sponsor adds it.
  • Q3, where to remove the key? From the Farcaster app's own source (farcasterxyz/client at 0c289ed): Settings -> "Advanced" (apps/farcaster-mobile/src/screens/Settings/SettingsScreen.tsx) -> section "Connected apps", button "Manage connected apps" (screens/Advanced/ConnectedAppsSection.tsx), revoke text "Permanently revoke sign in access for {app}" (components/RevokeConnectedAppKey.tsx). The section only shows when Farcaster's server sends showConnectedApps (contexts/UserAppContextProvider.tsx). David to confirm on phone that the path is there for his account; the UI text says "Settings, then Advanced, then Manage connected apps".
  • Q4, node paths on 0.15.0? Yes: GET /v1/castsByMention?fid= and GET /v1/linksByTargetFid?target_fid=&link_type=follow (snapchain v0.15.0 src/network/http_server.rs, server.rs). Both read every shard and concatenate per-shard pages unsorted, so the client sorts. Confirmed on the 0.15.0 devnet by scripts/e2e-phase1.ts.
  • Q5 is David's (which account to use for the live check).

Checks

Local, on commit ce7eaf6 and after (CI result is on this PR):

  1. npm run typecheck clean, npm test 141 pass, 0 fail (119 on 771b538), npm run build OK, bash test/providers.sh OK (new society sign-in block), shellcheck 0.10.0 clean.
  2. Mentions: test/mentions.test.ts proves byte offsets after 🎉 and Grüße, 日本 👩‍👩‍👧 . Devnet: scripts/e2e-phase1.ts stores mentions [a,b] at bytes [8,13] and the feed shows the names; from the web composer on the devnet (real serve.ts), @appuser-... looked up on the node, picked with Enter, stored as mentions [709878] at [3].
  3. Notifications: devnet, a second account's reply, mention, like (+ a third account's, grouped), recast and follow: all five in the web view and in ./outpost cli notifications, newest first; 5 new, 0 after "Mark all read", still 0 after reload.
  4. Sign-in: warning before the QR, QR + farcaster://signed-key-request?token=0x... link, no input in that path, signed in as FID 700 on the demo; with no app account the page explains ./outpost app-account and shows no QR.
  5. Secret: no app account key or its signature in any response or log (test/appsignin.test.ts, and the blind runs across 127 and 333 responses); stored files mode 600.
  6. Only 127.0.0.1 in the browser network log (demo and devnet). dist/web contains no api.farcaster.xyz; its other http strings are viem constants and the existing defaults (mainnet.optimism.io, snap.farcaster.xyz), not loaded in the demo.
  7. 390 and 1280 px: no horizontal scroll for notifications, connect choices, approve box and mention list; Tab reaches the 5th choice and notification buttons; suggestions work with arrows, Enter and Escape.

Blind verification (fresh subagent, given only the request, the 7 checks and the repo path), run twice:

  • Run 1: PARTIAL. 1, 2, 4, 5, 6, 7 PASS; 3 FAIL (web notifications empty on the devnet). Also: Enter did not pick a suggestion found by node lookup; the demo printed its throwaway key. Fixed in ce7eaf6.
  • Run 2 (the one re-run allowed): PARTIAL. 1, 4, 5, 6 PASS; the web halves of 2 and 3 FAIL and 7 UNVERIFIED, all for one reason: on a devnet the page could not check gasless keys (an http second node is blocked by the page's CSP), so it hid what they signed unless "Show them anyway" was pressed. Fixed in the last commit (devnet only: shown, marked "signer not verified"); re-checked by me on the devnet with no click (all of 2, 3, 7 above). Not blind-verified a third time.
  • Notes from the verifier, not changed: the CSP allows connect-src https: (existing, for charters and society nodes); an @partial not picked from the suggestions posts as plain text (by design: only picked names become mentions).

What David needs to do for the live check

No server needed: this uses Farcaster's public node (--public). On the Mac, in a checkout of this branch:

  1. npm ci && npm run build
  2. ./outpost app-account --public and type the app account's recovery phrase or custody key yourself in the hidden prompt. Use an account made for this, never a main account (Q5).
  3. ./outpost client --public, then open http://127.0.0.1:8381. The page says "Using Farcaster's public node, not your own". If this browser still has a key or a society node saved from earlier, use "Forget this key in this browser" or "Back to my own node" first.
  4. Choose "Approve in the Farcaster app", read the warning, scan the QR code with the phone that has the Farcaster app (or open the link on it), approve. Expect "Signed in as FID ..." and the key panel saying "Onchain key, approved in the Farcaster app".
  5. Post one cast. Then check it in the Farcaster app ("via" the app account's name in Outpost). The public node may refuse posts; if it does, the page shows its error. Copy it into the PR.
  6. Remove the key in the Farcaster app: Settings, Advanced, Manage connected apps (Q3: confirm the path is there). Then "Forget this key in this browser", and ./outpost app-account remove.

Optional: ./outpost cli --public login --app does the same from the terminal.

Not done

  • P2 stories 11 (notification filters) and 12 (byte counter).
  • Not run with the real Farcaster app or api.farcaster.xyz (rule: no mainnet writes). Tested against a stand-in endpoint that checks the signature, and on the devnet.
  • The society path (./outpost app-account --society) has not run on a real server; it is covered by test/providers.sh (fake server) and test/appsignin.test.ts.
  • Risk written down in TRUST.md: on a society node, a dishonest host's sign-in service could ask Farcaster to add the host's own key instead of the member's. The page cannot see which key the token stands for; it notices only after approval and then tells the member to remove the newest connected app.

🤖 Generated with Claude Code

Spider333 and others added 8 commits October 29, 2026 12:01
…LI name lookup

extractMentions turns picked @NAMEs into mentions and UTF-8 byte offsets
(correct after emoji and multibyte text), at most 10. A name edited after
it was picked stays plain text. The composer suggests followed accounts
first and looks a full username up on the node, kept only when the
account's signed profile carries it. ./outpost cli cast resolves @NAMEs
and stops on an unknown one; --no-mentions posts @ as text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replies and reactions to your last 25 casts, casts that mention you and
new followers, read with castsByParent, reactionsByCast, castsByMention and
linksByTargetFid (Hub gains castsByMention, linksByTarget, recastsByCast).
Every message passes the feed's checks; likes and recasts are grouped per
cast; newest first. The web client shows an unread count in the header,
mark all read per FID, partial results while a slow node answers, and opens
a notification's cast with its replies. ./outpost cli notifications
[--mark-read] does the same. scripts/e2e-phase1.ts checks it all on the
devnet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…local server

New 5th connect choice. The page makes the Ed25519 key and sends only its
public half to its own ./outpost client server, which signs Farcaster's
SignedKeyRequest with the app account (stored by ./outpost app-account,
mode 600) and asks api.farcaster.xyz for the approval link. The page shows
the full-access, no-expiry warning first, then a QR code (uqr, MIT, bundled)
and the link, polls, and saves the key only once its own node lists it as
an onchain key for that app. Same-origin POSTs only; only tokens the server
issued can be polled; no response or log carries the app account's key or
signature. The key panel labels such keys and says where to remove them.
On a devnet the page defaults key checks to the devnet's own second node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
app-account asks for the app account's phrase or custody key in a hidden
prompt, checks it owns an FID on your node, and stores it mode 600 for
./outpost client and login --app (status and remove need no server).
login --app shows the full-access warning, prints a terminal QR code and
the link, waits for approval, and saves the key only once your node lists
it as an onchain key for that app account. uninstall only forgets such a
key and says where to remove it. test/phase1-demo.ts runs the web client
on a fake node with a stand-in Farcaster endpoint that checks the app
account's EIP-712 signature; scripts/e2e-phase1.ts checks login --app on
the devnet, including the via label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… app account

./outpost app-account --society reads the app account's phrase or custody
key on the host's computer (hidden), checks it on the node, and sends it
over SSH to the server (mode 600 there; the local copy is deleted). A new
service (src/server/appsignin.ts, bundled to dist/appsignin.js) runs next
to the gate behind Caddy at /app-signin, members only by the gate's
tokens, CORS for the hosted client, read-only container. off stops it and
deletes the key from the server. Tested with the fake server in
test/providers.sh and in test/appsignin.test.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README: the sign-in table row, new sections for the approval and for
notifications and mentions, Limits updated (what is not tested yet:
the real Farcaster app on mainnet). TRUST.md: the one extra host, where
the app account's key lives, who may ask, and what a society host could
still do (ask Farcaster for its own key). SECURITY.md, AGENTS.md (the
person runs app-account; say what login --app gives away and wait for an
OK), CONTRIBUTING.md (devnet script and demo).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- "Show them anyway" now reloads notifications too, so on a node whose
  gasless keys cannot be checked (a devnet without a second node) they
  appear, marked like the feed.
- A suggestion found by looking the name up on the node is preselected,
  so Enter picks it instead of adding a newline and posting plain text.
- The demo no longer prints its throwaway key: /demo/as-me and
  /demo/fresh set the page up instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ssages marked

The page allows only https besides its own origin, so a devnet's plain-http
node cannot be the second node and every gasless key stays unchecked. On a
devnet only, show those messages marked "signer not verified" instead of
an empty feed, notifications list and suggestions. Mainnet is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

Spider333 and others added 4 commits October 30, 2026 08:40
…rver

./outpost client, cli and app-account take --public (Farcaster's public node),
--node <url> or OUTPOST_NODE_URL, and then skip the SSH tunnel, the provider and
every server command. Node URLs must be https, or http on this computer.

The page says it is on Farcaster's public node, not your own, with a "What does
that change?" toggle. Every message check stays. Gasless keys are checked
against crackle.farcaster.xyz, a second public node on a separate machine (the
same operator, and the page says so). serve.js forwards the second node and the
Optimism RPC too, so the browser still talks only to 127.0.0.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README Quickstart gets "Try it without a server", Settings gets
OUTPOST_NODE_URL, and Limits says what a node that is not yours can do.
TRUST.md says what the public-node mode trusts, including that the second
node is also Farcaster's. AGENTS.md gets a no-server row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…read-only

Fixes from blind verification: pictures default to off on a node that is not
yours (they loaded from imagedelivery.net); /outpost/optimism forwards only
read calls such as eth_call; the second-node field shows the node really used;
app-account says "the node", not "your node".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g the tunnel

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Spider333
Spider333 marked this pull request as ready for review November 3, 2026 10:45
@Spider333
Spider333 merged commit 9d51a7c into main Nov 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant